devices: Make sure to drain virtio TX port on stop#583
Open
d-e-s-o wants to merge 1 commit intocontainers:mainfrom
Open
devices: Make sure to drain virtio TX port on stop#583d-e-s-o wants to merge 1 commit intocontainers:mainfrom
d-e-s-o wants to merge 1 commit intocontainers:mainfrom
Conversation
1eec515 to
a389e70
Compare
Collaborator
|
LGTM, thanks! @mtjhrc PTAAL. |
I've encountered a race-condition where guest writes data to stderr shortly before exiting and that data never manifests on the host. The reason seems to be in libkrun's pop_head_blocking() (in the virtio console TX thread), when the stop flag is set the thread returns None without checking the queue one final time. Data already sitting in the virtio transmit queue is abandoned. Reorder the thread::park() call to make sure we check the queue one last time before stopping, which will ensure flushing of any remaining data on the port. I've verified the fix with several thousand iterations of a test case that earlier reproduced the problem in typically 10-50. Signed-off-by: Daniel Müller <deso@posteo.net>
a389e70 to
dab0c5d
Compare
Contributor
Author
|
Sorry, I rebased somehow thinking there was a need to update. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I've encountered a race-condition where guest writes data to stderr shortly before exiting and that data never manifests on the host. The reason seems to be in
pop_head_blocking()(in the virtio console TX thread), when thestopflag is set the thread returnsNonewithout checking the queue one final time. Data already sitting in the virtio transmit queue is abandoned.Reorder the
thread::park()call to make sure we check the queue one last time before stopping, which will ensure flushing of any remaining data on the port. I've verified the fix with several thousand iterations of a test case that earlier reproduced the problem in typically 10-50.